/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_STATE_GRID_A_DATA_TYPE_H
#define MK_STATE_GRID_A_DATA_TYPE_H
#include "MkUtil/MkTime.h"
#include "MkSip/MkSipServer.h"
#include "MkUtil/MkPtzCommand.h"

typedef enum _state_grid_a_message_type
{
    MkStateGridAMedia,
    MkStateGridAMediaShutDown,
    MkStateGridAPtzControl,
    MkStateGridASubscribe,
    MkStateGridASubscribeNotify
}MkStateGridAMessageType;

typedef enum _state_grid_a_subscribe_type
{
    MkStateGridASubscribeAlarm,
    MkStateGridASubscribeStatus,
    MkStateGridASubscribeEnd
}MkStateGridASubscribeType;
//
//typedef enum _state_grid_a_ptz_command_type
//{
//    MkStateGridAPtz3DZoom = 0x0001,
//    MkStateGridAPtzApertuerCloseStop = 0x0101,
//    MkStateGridAPtzApertuerClose = 0x0102,
//    MkStateGridAPtzApertuerOpen = 0x0103,
//    MkStateGridAPtzApertuerOpenStop = 0x0104,
//    MkStateGridAPtzFocusNearStop = 0x0201,
//    MkStateGridAPtzFocusNear = 0x0202,
//    MkStateGridAPtzFocusFarStop = 0x0203,
//    MkStateGridAPtzFocusFar = 0x0204,
//    MkStateGridAPtzZoomInStop = 0x0301,
//    MkStateGridAPtzZoomIn = 0x0302,
//    MkStateGridAPtzZoomOutStop = 0x0303,
//    MkStateGridAPtzZoomOut = 0x0304,
//    MkStateGridAPtzUpStop = 0x0401,
//    MkStateGridAPtzUp = 0x0402,
//    MkStateGridAPtzDownStop = 0x0403,
//    MkStateGridAPtzDown = 0x0404,
//    MkStateGridAPtzRightStop = 0x0501,
//    MkStateGridAPtzRight = 0x0502,
//    MkStateGridAPtzLeftStop = 0x0503,
//    MkStateGridAPtzLeft = 0x0504,
//    MkStateGridAPtzSetPreset = 0x0601,
//    MkStateGridAPtzCallPreset = 0x0602,
//    MkStateGridAPtzDelPreset = 0x0603,
//    MkStateGridAPtzLeftUpStop = 0x0701,
//    MkStateGridAPtzLeftUp = 0x0702,
//    MkStateGridAPtzLeftDownStop = 0x0703,
//    MkStateGridAPtzLeftDown = 0x0704,
//    MkStateGridAPtzRightUpStop = 0x0801,
//    MkStateGridAPtzRightUp = 0x0802,
//    MkStateGridAPtzRightDownStop = 0x0803,
//    MkStateGridAPtzRightDown = 0x0804,
//    MkStateGridAPtzStop = 0x0901,
//    MkStateGridAPtzWiperOn = 0x0a01,
//    MkStateGridAPtzWiperOff = 0x0a02,
//    MkStateGridAPtzLightOn = 0x0b01,
//    MkStateGridAPtzLightOff = 0x0b02,
//    MkStateGridAPtzWarmOn = 0x0c01,
//    MkStateGridAPtzWarmOff = 0x0c02,
//    MkStateGridAPtzInfraredOn = 0x0d01,
//    MkStateGridAPtzInfraredOff = 0x0d02,
//    MkStateGridAPtzLinearSweep = 0x0e01,
//    MkStateGridAPtzLinearSweepStop = 0x0e02,
//    MkStateGridAPtzTrajectoryCruise = 0x0f01,
//    MkStateGridAPtzTrajectoryCruiseStop = 0x0f02,
//    MkStateGridAPtzPresetCruise = 0x1001,
//    MkStateGridAPtzPresetCruiseOff = 0x1002,
//    MkStateGridAPtzLock = 0x1101,
//    MkStateGridAPtzUnLock = 0x1102,
//    MkStateGridAPtzSetDefaultPreset = 0x1201
//}MkStateGridAPtzCommandType;

class MkApi CMkStateGridARequestBase
{
public:
    CMkStateGridARequestBase(const MkStateGridAMessageType& MsgType);
    virtual ~CMkStateGridARequestBase() {};

    const MkStateGridAMessageType& GetMsgType() const { return m_MsgType; }
protected:
private:
    MkStateGridAMessageType  m_MsgType;
};

class MkApi CMkStateGridAMediaRequest : public CMkStateGridARequestBase
{
public:
    CMkStateGridAMediaRequest(const MkString& SessionId, const MkString& ChannelId, const MkString& RtpHost, Uint16 RtpPort, Uint8 Payload, BOOL bSubStream);
    ~CMkStateGridAMediaRequest() {};
    const MkString& GetChannelId() const { return m_ChannelId; }
    const MkString& GetRtpHost() const { return m_RtpHost; }
    //const Uint16& GetRtpVideoPort() const { return m_RtpVideoPort; }
    //const Uint16& GetRtpAudioPort() const { return m_RtpAuidoPort; }
    const Uint16& GetRtpPort() const { return m_RtpPort; }
    const MkString& GetSessionId() const { return m_SessionId; }
    const Uint8& GetPayload() const { return m_Payload; }
    const BOOL& IsSubStream() const { return m_bSubStream; }
protected:
private:
    MkString    m_SessionId;
    MkString    m_ChannelId;
    MkString    m_RtpHost;
    BOOL        m_bSubStream;
    //Uint16      m_RtpAuidoPort;
    //Uint16      m_RtpVideoPort;
    Uint16      m_RtpPort;
    Uint8       m_Payload;
};

class MkApi CMkStateGridAMediaShutDownRequest : public CMkStateGridARequestBase
{
public:
    CMkStateGridAMediaShutDownRequest(const MkString& SessionId);
    ~CMkStateGridAMediaShutDownRequest() {};
    const MkString& GetSession() const { return m_SessionId; }
protected:
private:
    MkString    m_SessionId;
};

class MkApi CMkStateGridAPtzControlRequest : public CMkStateGridARequestBase
{
public:
    CMkStateGridAPtzControlRequest(const MkString& ChannelId, MkStateGridPtzCommandType Cmd, Uint32 Param1, Uint32 Param2, Uint32 Param3, Uint32 Param4, Uint32 Param5, Uint32 Param6, Uint32 Param7);
    ~CMkStateGridAPtzControlRequest() {};

    const MkStateGridPtzCommandType& GetCmd() const { return m_Cmd; }
    const Uint32& GetParam1() const { return m_Param1; }
    const Uint32& GetParam2() const { return m_Param2; }
    const Uint32& GetParam3() const { return m_Param3; }
    const Uint32& GetParam4() const { return m_Param4; }
    const Uint32& GetParam5() const { return m_Param5; }
    const Uint32& GetParam6() const { return m_Param6; }
    const Uint32& GetParam7() const { return m_Param7; }
    const MkString& GetChannelId() const { return m_ChannelId; }
protected:
private:
    MkString m_ChannelId;
    MkStateGridPtzCommandType m_Cmd;
    Uint32 m_Param1;
    Uint32 m_Param2;
    Uint32 m_Param3;
    Uint32 m_Param4;
    Uint32 m_Param5;
    Uint32 m_Param6;
    Uint32 m_Param7;
};

class MkApi CMkStateGridASubscribeRequest : public CMkStateGridARequestBase
{
public:
    CMkStateGridASubscribeRequest(const MkString& SubscribeId, Uint32 Expries, const MkStateGridASubscribeType& SubType, const MkMap<MkString, Uint32>& MapSubId);
    ~CMkStateGridASubscribeRequest() {};

    const Uint32& GetExpries() const { return m_Expires; }
    const MkMap<MkString, Uint32>& GetMapSubCode() const { return m_MapSubCode; }
    const MkString& GetSubscribeId() const { return m_SubscribeId; }
    const MkStateGridASubscribeType& GetSubscribeType() const { return m_SubType; }
protected:
private:
    Uint32                  m_Expires;
    MkMap<MkString, Uint32> m_MapSubCode;
    MkString                m_SubscribeId;
    MkStateGridASubscribeType   m_SubType;
};

class MkApi CMkStateGridAAlarmNotifyRequest : public CMkStateGridARequestBase
{
public:
    CMkStateGridAAlarmNotifyRequest(const MkString& StrState, const MkString& Code, const MkString& Name, const Uint32 AlarmType, const CMkTime& StartTime, const CMkTime& EndTime);
    ~CMkStateGridAAlarmNotifyRequest() {};

    const MkString& GetState() const { return m_StrState; }
    const MkString& GetCode() const { return m_Code; }
    const MkString& GetName() const { return m_Name; }
    const Uint32& GetAlarmType() const { return m_AlarmType; }
    const CMkTime& GetStartTime() const { return m_StartTime; }
    const CMkTime& GetEndTime() const { return m_EndTime; }
protected:
private:
    MkString m_StrState;
    MkString m_Code;
    MkString m_Name;
    Uint32   m_AlarmType;
    CMkTime  m_StartTime;
    CMkTime  m_EndTime;
};

class MkApi CMkStateGridAStatusNotifyRequest : public CMkStateGridARequestBase
{
public:
    CMkStateGridAStatusNotifyRequest(const MkString& StrState, const MkString& Code, const MkString& Name, Uint32 Status);
    ~CMkStateGridAStatusNotifyRequest() {};

    const MkString& GetState() const { return m_StrState; }
    const MkString& GetCode() const { return m_Code; }
    const MkString& GetName() const { return m_Name; }
    const Uint32& GetStatus() const { return m_Status; }
protected:
private:
    MkString m_StrState;
    MkString m_Code;
    MkString m_Name;
    Uint32 m_Status;
};

class MkApi CMkStateGridAResponseBase
{
public:
    CMkStateGridAResponseBase(const MkStateGridAMessageType& MsgType);
    virtual ~CMkStateGridAResponseBase() {};

    const MkStateGridAMessageType& GetMsgType() const { return m_MsgType; }
protected:
private:
    MkStateGridAMessageType  m_MsgType;
};

class MkApi CMkStateGridASubscribeResponse : public CMkStateGridAResponseBase
{
public:
    CMkStateGridASubscribeResponse(const MkString& SubscribeId, Uint32 Expires);
    ~CMkStateGridASubscribeResponse() {};
    const MkString& GetSubscribeId() const { return m_SubscribeId; }
    const Uint32& GetExpires() const { return m_Expires; }
protected:
private:
    MkString        m_SubscribeId;
    Uint32          m_Expires;
};

class MkApi CMkStateGridAMediaResponse : public CMkStateGridAResponseBase
{
public:
    CMkStateGridAMediaResponse(const MkString& SessionId, const MkString& RtpHost, Uint16 RtpPort, const EventResponseCallback& EventCb);
    ~CMkStateGridAMediaResponse() {};

    const MkString& GetRtpHost()const { return m_RtpHost; }
    const Uint16& GetRtpPort() const { return m_RtpPort; }
    const MkString& GetSessionId() const { return m_SessionId; }
    const EventResponseCallback& GetEventCb() const { return m_EventCb; }
protected:
private:
    MkString    m_SessionId;
    MkString    m_RtpHost;
    Uint16      m_RtpPort;
    EventResponseCallback  m_EventCb;
};




#endif